<template>
  <div>
    <ul>
      <li v-for="(item,key) in list" :key="key">
        {{ item }} <button @click="shangchu(key)">删除</button>
      </li>
    </ul>
    <button @click="shengcheng">生成</button>
  </div>
</template>

<script>
export default {
data(){
  return {
    list:[1,5,3]
  }
},
methods: {
    shengcheng() {
      this.list.push(Math.floor(Math.random() * 100));
    },
    shangchu(i) {
      this.list.splice(i,1);
    },
  },
}
</script>

<style>

</style>